/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Random;

/**
 * <p>Project: app2022 - IfTest1
 * <p>Powered by webrx On 2022-01-07 08:55:11
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class IfTest2 {

    public static void main(String[] args) throws ParseException {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        sdf.parse("1985-06-07 18:20:30");


        // true ? System.out.println("ok") : System.out.println("nnnn");

        System.out.println(true ? "ok" : "nnnn");

        String ts = true ? "ok" : "nnnn";
        System.out.println(ts);

        Calendar c = Calendar.getInstance();
        int h = c.get(Calendar.HOUR_OF_DAY);
        if (h < 12) {
            System.out.println("上午");
        } else {
            System.out.println("下午");
        }

        System.out.printf("%tp %n", c);

        // true ? "yes" : "no"
        Random rand = new Random();
        String str = rand.nextBoolean() ? "yes" : "no";
        System.out.println(str);
        System.out.println(h < 12 ? "上午" : "下午");

    }

    public static void t(String[] args) {
        Calendar c = Calendar.getInstance();
        int w = c.get(Calendar.DAY_OF_WEEK);//1-7 1星期日
//        if (w == 1) System.out.println("星期日");
//        if (w == 2) System.out.println("星期一");
//        if (w == 3) System.out.println("星期二");
//        if (w == 4) System.out.println("星期三");
//        if (w == 5) System.out.println("星期四");
//        if (w == 6) System.out.println("星期五");
//        if (w == 7) System.out.println("星期六");
        if (w == 1) {
            System.out.println("星期日");
        } else if (w == 2) {
            System.out.println("星期一");
        } else if (w == 3) {
            System.out.println("星期二");
        } else if (w == 4) {
            System.out.println("星期三");
        } else if (w == 5) {
            System.out.println("星期四");
        } else if (w == 6) {
            System.out.println("星期五");
        } else {
            System.out.println("星期六");
        }

        int year = c.get(Calendar.YEAR);
        System.out.println("猴鸡狗猪鼠牛虎兔龙蛇马羊".charAt(year % 12));
        //10  十月


    }
}
